//
//  BarberCollectionView.m
//  afn
//
//  Created by mac on 2018/5/8.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "BarberCollectionView.h"

@implementation BarberCollectionView

-(void)creatView{
    self.layer.cornerRadius=4;
    UIImageView *imageView=[UIImageView new];
    [self addSubview:imageView];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(_mainW/2-15);
    }];
    NSString *url=_model.pic_url;
    [imageView sd_setImageWithURL:[NSURL URLWithString:url]];
    
    UIView *bottomView=[UIView new];
    [self addSubview:bottomView];
    [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.left.right.mas_equalTo(0);
        make.height.mas_equalTo(40);
    }];
    bottomView.backgroundColor=[UIColor whiteColor];
    
    UILabel *nameLabel=[UILabel new];
    [bottomView addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.center.mas_equalTo(0);
    }];
    nameLabel.text=_model.barber_name;
    nameLabel.font=[UIFont systemFontOfSize:13];
    nameLabel.textColor=ColorWithRGB(29, 29, 29);
    
    CGSize size=[gongju getNSStringWeight:_model.position andViewWight:14 andFont:13];
    
    UILabel *zhiWeiLabel=[UILabel new];
    [bottomView addSubview:zhiWeiLabel];
    [zhiWeiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.width.mas_equalTo(size.width+6);
    }];
    zhiWeiLabel.textAlignment=NSTextAlignmentCenter;
    zhiWeiLabel.layer.cornerRadius=2;
    zhiWeiLabel.textColor=_backgroundColor;
    zhiWeiLabel.font=[UIFont systemFontOfSize:12];
    zhiWeiLabel.layer.borderWidth=1;
    zhiWeiLabel.layer.borderColor=_backgroundColor.CGColor;
    zhiWeiLabel.text=_model.position;
    
}

@end
